/*$(function(){
	$('.table-sort').dataTable({
		"aaSorting": [[ 1, "desc" ]],//默认第几个排序
		"bStateSave": true,//状态保存
		"aoColumnDefs": [
		  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
		  {"orderable":false,"aTargets":[0,4]}// 制定列不参与排序
		]
	});

});
http://datatables.club/manual/server-side.html
*/

/**
 * DataTables
 */
var datatable = null,idList=[];

$(function() {
	datatable = $('.table-sort').dataTable({
		order: [
			[1, 'asc']
		],
		bRetrieve: true,
		autoWidth: true,
		searching : false,
		lengthChange: false,	
		processing: true, //当datatable获取数据时候是否显示正在处理提示信息。
		serverSide: true, //服务器处理分页
		responsive: {
			details: false
		},
	    //lengthMenu: [100],   // 每页显示数据（默认是10）
	    ordering: false,//是否允许用户排序
	    paging: true,//是否分页
	    pagingType: "full_numbers",//除首页、上一页、下一页、末页四个按钮还有页数按钮
	    /* scrollX: true,//允许水平滚动
	     scrollY: "200px",
	     scrollCollapse: true, */
	    stateSave: false,//刷新时是否保存状态
	    //deferRender: true,//延迟渲染
		ajax: {
			url: contextPath + "/scenicSpot/getPageList",
			type: 'post',
			data: function(d) {
				//d.search = $('#search').val();
			}
		},	
		language: {
			"url": "../resources/js/datatables_language.json"
		},
		columns: [
			{data: "scenicSpotId"},
			{data: "scenicSpot",defaultContent: ""},
			{data: "address",defaultContent: ""},
			{data: "priorityLevel",defaultContent: ""},
			{data: "price",defaultContent: ""},
			{data: "terminalNumber",defaultContent: ""},
			{data: "createTime",defaultContent: ""},
			{data: "modifyTime",defaultContent: ""},
			{data: null}
			],
		columnDefs: [{
			targets: [0],
			orderable:false,
			render: function(data, type, row, meta) {
				return '<input id="input-' + data + '" type="checkbox" name="single"><label for="input-' + data + '"></label>';
			}  
		}, {
			targets: [6],
			render: function(data, type, row, meta) {
				return data ? new Date(data).pattern("yyyy-MM-dd HH:mm:ss") : '';
			}
		}, {
			targets: [7],
			render: function(data, type, row, meta) {
				return data ? new Date(data).pattern("yyyy-MM-dd HH:mm:ss") : '';
			}
		}, {
			targets: [8],
			orderable:false,
			responsivePriority: 1,
			render: function(data, type, row, meta) {
				var btns = new Array('edit','del');
				return getDTOperateBtn(btns, row.scenicSpotId, '/scenicSpot/scenicSpot-add.html', null, '/scenicSpot/delete', reloadTable);
			}
		}]
	});

});
